#include <stdio.h>

int myatoi(const char *p);

int main(int argc, char** argv)
{
	int num = 0;

	if (argc < 2) {
		return 1;
	}

	num = myatoi(argv[1]);

	printf("%d\n", num);

	return 0;
}

static int is_digit(char c)
{
	return c >= '0' && c <= '9';
}

int myatoi(const char *p)
{
	int i = 0;
	int num = 0;

	while (p[i] && is_digit(p[i])) {
		num = num * 10 + (p[i] - '0');
		i++;
	}

	return num;
}
